package com.wxdc.nmgyt.nmgytwydc.greendao;

import java.util.List;
import android.database.Cursor;
import android.database.sqlite.SQLiteStatement;

import org.greenrobot.greendao.AbstractDao;
import org.greenrobot.greendao.Property;
import org.greenrobot.greendao.internal.DaoConfig;
import org.greenrobot.greendao.database.Database;
import org.greenrobot.greendao.database.DatabaseStatement;
import org.greenrobot.greendao.query.Query;
import org.greenrobot.greendao.query.QueryBuilder;

import com.wxdc.nmgyt.nmgytwydc.model.CbYfWzInfoBean;

// THIS CODE IS GENERATED BY greenDAO, DO NOT EDIT.
/** 
 * DAO for table "CB_YF_WZ_INFO_BEAN".
*/
public class CbYfWzInfoBeanDao extends AbstractDao<CbYfWzInfoBean, Long> {

    public static final String TABLENAME = "CB_YF_WZ_INFO_BEAN";

    /**
     * Properties of entity CbYfWzInfoBean.<br/>
     * Can be used for QueryBuilder and for referencing column names.
     */
    public static class Properties {
        public final static Property Id = new Property(0, Long.class, "id", true, "_id");
        public final static Property ID = new Property(1, String.class, "ID", false, "ID");
        public final static Property GRASSID = new Property(2, String.class, "GRASSID", false, "GRASSID");
        public final static Property WZDM = new Property(3, String.class, "WZDM", false, "WZDM");
        public final static Property WZMC = new Property(4, String.class, "WZMC", false, "WZMC");
        public final static Property ZGDONE = new Property(5, String.class, "ZGDONE", false, "ZGDONE");
        public final static Property ZGDTWO = new Property(6, String.class, "ZGDTWO", false, "ZGDTWO");
        public final static Property ZGDTHREE = new Property(7, String.class, "ZGDTHREE", false, "ZGDTHREE");
        public final static Property ZGDFOUR = new Property(8, String.class, "ZGDFOUR", false, "ZGDFOUR");
        public final static Property ZGDFIVE = new Property(9, String.class, "ZGDFIVE", false, "ZGDFIVE");
        public final static Property ZGDAVG = new Property(10, String.class, "ZGDAVG", false, "ZGDAVG");
        public final static Property CFLENGTH = new Property(11, String.class, "CFLENGTH", false, "CFLENGTH");
        public final static Property CFWIDTH = new Property(12, String.class, "CFWIDTH", false, "CFWIDTH");
        public final static Property ZCS = new Property(13, String.class, "ZCS", false, "ZCS");
        public final static Property SWLXZ = new Property(14, String.class, "SWLXZ", false, "SWLXZ");
        public final static Property SWLGZ = new Property(15, String.class, "SWLGZ", false, "SWLGZ");
        public final static Property BZ = new Property(16, String.class, "BZ", false, "BZ");
        public final static Property SHBZ = new Property(17, String.class, "SHBZ", false, "SHBZ");
        public final static Property VERSION = new Property(18, String.class, "VERSION", false, "VERSION");
        public final static Property DBMARK = new Property(19, String.class, "DBMARK", false, "DBMARK");
        public final static Property CbyfInfoId = new Property(20, Long.class, "cbyfInfoId", false, "CBYF_INFO_ID");
    }

    private Query<CbYfWzInfoBean> cbYfInfoBean_GRASS_WZQuery;

    public CbYfWzInfoBeanDao(DaoConfig config) {
        super(config);
    }
    
    public CbYfWzInfoBeanDao(DaoConfig config, DaoSession daoSession) {
        super(config, daoSession);
    }

    /** Creates the underlying database table. */
    public static void createTable(Database db, boolean ifNotExists) {
        String constraint = ifNotExists? "IF NOT EXISTS ": "";
        db.execSQL("CREATE TABLE " + constraint + "\"CB_YF_WZ_INFO_BEAN\" (" + //
                "\"_id\" INTEGER PRIMARY KEY AUTOINCREMENT ," + // 0: id
                "\"ID\" TEXT," + // 1: ID
                "\"GRASSID\" TEXT," + // 2: GRASSID
                "\"WZDM\" TEXT," + // 3: WZDM
                "\"WZMC\" TEXT," + // 4: WZMC
                "\"ZGDONE\" TEXT," + // 5: ZGDONE
                "\"ZGDTWO\" TEXT," + // 6: ZGDTWO
                "\"ZGDTHREE\" TEXT," + // 7: ZGDTHREE
                "\"ZGDFOUR\" TEXT," + // 8: ZGDFOUR
                "\"ZGDFIVE\" TEXT," + // 9: ZGDFIVE
                "\"ZGDAVG\" TEXT," + // 10: ZGDAVG
                "\"CFLENGTH\" TEXT," + // 11: CFLENGTH
                "\"CFWIDTH\" TEXT," + // 12: CFWIDTH
                "\"ZCS\" TEXT," + // 13: ZCS
                "\"SWLXZ\" TEXT," + // 14: SWLXZ
                "\"SWLGZ\" TEXT," + // 15: SWLGZ
                "\"BZ\" TEXT," + // 16: BZ
                "\"SHBZ\" TEXT," + // 17: SHBZ
                "\"VERSION\" TEXT," + // 18: VERSION
                "\"DBMARK\" TEXT," + // 19: DBMARK
                "\"CBYF_INFO_ID\" INTEGER);"); // 20: cbyfInfoId
    }

    /** Drops the underlying database table. */
    public static void dropTable(Database db, boolean ifExists) {
        String sql = "DROP TABLE " + (ifExists ? "IF EXISTS " : "") + "\"CB_YF_WZ_INFO_BEAN\"";
        db.execSQL(sql);
    }

    @Override
    protected final void bindValues(DatabaseStatement stmt, CbYfWzInfoBean entity) {
        stmt.clearBindings();
 
        Long id = entity.getId();
        if (id != null) {
            stmt.bindLong(1, id);
        }
 
        String ID = entity.getID();
        if (ID != null) {
            stmt.bindString(2, ID);
        }
 
        String GRASSID = entity.getGRASSID();
        if (GRASSID != null) {
            stmt.bindString(3, GRASSID);
        }
 
        String WZDM = entity.getWZDM();
        if (WZDM != null) {
            stmt.bindString(4, WZDM);
        }
 
        String WZMC = entity.getWZMC();
        if (WZMC != null) {
            stmt.bindString(5, WZMC);
        }
 
        String ZGDONE = entity.getZGDONE();
        if (ZGDONE != null) {
            stmt.bindString(6, ZGDONE);
        }
 
        String ZGDTWO = entity.getZGDTWO();
        if (ZGDTWO != null) {
            stmt.bindString(7, ZGDTWO);
        }
 
        String ZGDTHREE = entity.getZGDTHREE();
        if (ZGDTHREE != null) {
            stmt.bindString(8, ZGDTHREE);
        }
 
        String ZGDFOUR = entity.getZGDFOUR();
        if (ZGDFOUR != null) {
            stmt.bindString(9, ZGDFOUR);
        }
 
        String ZGDFIVE = entity.getZGDFIVE();
        if (ZGDFIVE != null) {
            stmt.bindString(10, ZGDFIVE);
        }
 
        String ZGDAVG = entity.getZGDAVG();
        if (ZGDAVG != null) {
            stmt.bindString(11, ZGDAVG);
        }
 
        String CFLENGTH = entity.getCFLENGTH();
        if (CFLENGTH != null) {
            stmt.bindString(12, CFLENGTH);
        }
 
        String CFWIDTH = entity.getCFWIDTH();
        if (CFWIDTH != null) {
            stmt.bindString(13, CFWIDTH);
        }
 
        String ZCS = entity.getZCS();
        if (ZCS != null) {
            stmt.bindString(14, ZCS);
        }
 
        String SWLXZ = entity.getSWLXZ();
        if (SWLXZ != null) {
            stmt.bindString(15, SWLXZ);
        }
 
        String SWLGZ = entity.getSWLGZ();
        if (SWLGZ != null) {
            stmt.bindString(16, SWLGZ);
        }
 
        String BZ = entity.getBZ();
        if (BZ != null) {
            stmt.bindString(17, BZ);
        }
 
        String SHBZ = entity.getSHBZ();
        if (SHBZ != null) {
            stmt.bindString(18, SHBZ);
        }
 
        String VERSION = entity.getVERSION();
        if (VERSION != null) {
            stmt.bindString(19, VERSION);
        }
 
        String DBMARK = entity.getDBMARK();
        if (DBMARK != null) {
            stmt.bindString(20, DBMARK);
        }
 
        Long cbyfInfoId = entity.getCbyfInfoId();
        if (cbyfInfoId != null) {
            stmt.bindLong(21, cbyfInfoId);
        }
    }

    @Override
    protected final void bindValues(SQLiteStatement stmt, CbYfWzInfoBean entity) {
        stmt.clearBindings();
 
        Long id = entity.getId();
        if (id != null) {
            stmt.bindLong(1, id);
        }
 
        String ID = entity.getID();
        if (ID != null) {
            stmt.bindString(2, ID);
        }
 
        String GRASSID = entity.getGRASSID();
        if (GRASSID != null) {
            stmt.bindString(3, GRASSID);
        }
 
        String WZDM = entity.getWZDM();
        if (WZDM != null) {
            stmt.bindString(4, WZDM);
        }
 
        String WZMC = entity.getWZMC();
        if (WZMC != null) {
            stmt.bindString(5, WZMC);
        }
 
        String ZGDONE = entity.getZGDONE();
        if (ZGDONE != null) {
            stmt.bindString(6, ZGDONE);
        }
 
        String ZGDTWO = entity.getZGDTWO();
        if (ZGDTWO != null) {
            stmt.bindString(7, ZGDTWO);
        }
 
        String ZGDTHREE = entity.getZGDTHREE();
        if (ZGDTHREE != null) {
            stmt.bindString(8, ZGDTHREE);
        }
 
        String ZGDFOUR = entity.getZGDFOUR();
        if (ZGDFOUR != null) {
            stmt.bindString(9, ZGDFOUR);
        }
 
        String ZGDFIVE = entity.getZGDFIVE();
        if (ZGDFIVE != null) {
            stmt.bindString(10, ZGDFIVE);
        }
 
        String ZGDAVG = entity.getZGDAVG();
        if (ZGDAVG != null) {
            stmt.bindString(11, ZGDAVG);
        }
 
        String CFLENGTH = entity.getCFLENGTH();
        if (CFLENGTH != null) {
            stmt.bindString(12, CFLENGTH);
        }
 
        String CFWIDTH = entity.getCFWIDTH();
        if (CFWIDTH != null) {
            stmt.bindString(13, CFWIDTH);
        }
 
        String ZCS = entity.getZCS();
        if (ZCS != null) {
            stmt.bindString(14, ZCS);
        }
 
        String SWLXZ = entity.getSWLXZ();
        if (SWLXZ != null) {
            stmt.bindString(15, SWLXZ);
        }
 
        String SWLGZ = entity.getSWLGZ();
        if (SWLGZ != null) {
            stmt.bindString(16, SWLGZ);
        }
 
        String BZ = entity.getBZ();
        if (BZ != null) {
            stmt.bindString(17, BZ);
        }
 
        String SHBZ = entity.getSHBZ();
        if (SHBZ != null) {
            stmt.bindString(18, SHBZ);
        }
 
        String VERSION = entity.getVERSION();
        if (VERSION != null) {
            stmt.bindString(19, VERSION);
        }
 
        String DBMARK = entity.getDBMARK();
        if (DBMARK != null) {
            stmt.bindString(20, DBMARK);
        }
 
        Long cbyfInfoId = entity.getCbyfInfoId();
        if (cbyfInfoId != null) {
            stmt.bindLong(21, cbyfInfoId);
        }
    }

    @Override
    public Long readKey(Cursor cursor, int offset) {
        return cursor.isNull(offset + 0) ? null : cursor.getLong(offset + 0);
    }    

    @Override
    public CbYfWzInfoBean readEntity(Cursor cursor, int offset) {
        CbYfWzInfoBean entity = new CbYfWzInfoBean( //
            cursor.isNull(offset + 0) ? null : cursor.getLong(offset + 0), // id
            cursor.isNull(offset + 1) ? null : cursor.getString(offset + 1), // ID
            cursor.isNull(offset + 2) ? null : cursor.getString(offset + 2), // GRASSID
            cursor.isNull(offset + 3) ? null : cursor.getString(offset + 3), // WZDM
            cursor.isNull(offset + 4) ? null : cursor.getString(offset + 4), // WZMC
            cursor.isNull(offset + 5) ? null : cursor.getString(offset + 5), // ZGDONE
            cursor.isNull(offset + 6) ? null : cursor.getString(offset + 6), // ZGDTWO
            cursor.isNull(offset + 7) ? null : cursor.getString(offset + 7), // ZGDTHREE
            cursor.isNull(offset + 8) ? null : cursor.getString(offset + 8), // ZGDFOUR
            cursor.isNull(offset + 9) ? null : cursor.getString(offset + 9), // ZGDFIVE
            cursor.isNull(offset + 10) ? null : cursor.getString(offset + 10), // ZGDAVG
            cursor.isNull(offset + 11) ? null : cursor.getString(offset + 11), // CFLENGTH
            cursor.isNull(offset + 12) ? null : cursor.getString(offset + 12), // CFWIDTH
            cursor.isNull(offset + 13) ? null : cursor.getString(offset + 13), // ZCS
            cursor.isNull(offset + 14) ? null : cursor.getString(offset + 14), // SWLXZ
            cursor.isNull(offset + 15) ? null : cursor.getString(offset + 15), // SWLGZ
            cursor.isNull(offset + 16) ? null : cursor.getString(offset + 16), // BZ
            cursor.isNull(offset + 17) ? null : cursor.getString(offset + 17), // SHBZ
            cursor.isNull(offset + 18) ? null : cursor.getString(offset + 18), // VERSION
            cursor.isNull(offset + 19) ? null : cursor.getString(offset + 19), // DBMARK
            cursor.isNull(offset + 20) ? null : cursor.getLong(offset + 20) // cbyfInfoId
        );
        return entity;
    }
     
    @Override
    public void readEntity(Cursor cursor, CbYfWzInfoBean entity, int offset) {
        entity.setId(cursor.isNull(offset + 0) ? null : cursor.getLong(offset + 0));
        entity.setID(cursor.isNull(offset + 1) ? null : cursor.getString(offset + 1));
        entity.setGRASSID(cursor.isNull(offset + 2) ? null : cursor.getString(offset + 2));
        entity.setWZDM(cursor.isNull(offset + 3) ? null : cursor.getString(offset + 3));
        entity.setWZMC(cursor.isNull(offset + 4) ? null : cursor.getString(offset + 4));
        entity.setZGDONE(cursor.isNull(offset + 5) ? null : cursor.getString(offset + 5));
        entity.setZGDTWO(cursor.isNull(offset + 6) ? null : cursor.getString(offset + 6));
        entity.setZGDTHREE(cursor.isNull(offset + 7) ? null : cursor.getString(offset + 7));
        entity.setZGDFOUR(cursor.isNull(offset + 8) ? null : cursor.getString(offset + 8));
        entity.setZGDFIVE(cursor.isNull(offset + 9) ? null : cursor.getString(offset + 9));
        entity.setZGDAVG(cursor.isNull(offset + 10) ? null : cursor.getString(offset + 10));
        entity.setCFLENGTH(cursor.isNull(offset + 11) ? null : cursor.getString(offset + 11));
        entity.setCFWIDTH(cursor.isNull(offset + 12) ? null : cursor.getString(offset + 12));
        entity.setZCS(cursor.isNull(offset + 13) ? null : cursor.getString(offset + 13));
        entity.setSWLXZ(cursor.isNull(offset + 14) ? null : cursor.getString(offset + 14));
        entity.setSWLGZ(cursor.isNull(offset + 15) ? null : cursor.getString(offset + 15));
        entity.setBZ(cursor.isNull(offset + 16) ? null : cursor.getString(offset + 16));
        entity.setSHBZ(cursor.isNull(offset + 17) ? null : cursor.getString(offset + 17));
        entity.setVERSION(cursor.isNull(offset + 18) ? null : cursor.getString(offset + 18));
        entity.setDBMARK(cursor.isNull(offset + 19) ? null : cursor.getString(offset + 19));
        entity.setCbyfInfoId(cursor.isNull(offset + 20) ? null : cursor.getLong(offset + 20));
     }
    
    @Override
    protected final Long updateKeyAfterInsert(CbYfWzInfoBean entity, long rowId) {
        entity.setId(rowId);
        return rowId;
    }
    
    @Override
    public Long getKey(CbYfWzInfoBean entity) {
        if(entity != null) {
            return entity.getId();
        } else {
            return null;
        }
    }

    @Override
    public boolean hasKey(CbYfWzInfoBean entity) {
        return entity.getId() != null;
    }

    @Override
    protected final boolean isEntityUpdateable() {
        return true;
    }
    
    /** Internal query to resolve the "GRASS_WZ" to-many relationship of CbYfInfoBean. */
    public List<CbYfWzInfoBean> _queryCbYfInfoBean_GRASS_WZ(Long cbyfInfoId) {
        synchronized (this) {
            if (cbYfInfoBean_GRASS_WZQuery == null) {
                QueryBuilder<CbYfWzInfoBean> queryBuilder = queryBuilder();
                queryBuilder.where(Properties.CbyfInfoId.eq(null));
                cbYfInfoBean_GRASS_WZQuery = queryBuilder.build();
            }
        }
        Query<CbYfWzInfoBean> query = cbYfInfoBean_GRASS_WZQuery.forCurrentThread();
        query.setParameter(0, cbyfInfoId);
        return query.list();
    }

}
